#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

vector<string> mkdir(vector<string>& cmd){
	int n = cmd.size();
	vector<string> ret;
	for (int i = 1; i < n; ++i){
        // 检验前一个短串是否为下一个长串的子串
        if (cmd[i].find(cmd[i-1]) != string::npos && \
            cmd[i][cmd[i-1].size()] == '/')
            continue;   // 前串是后串的子串，而且后串后一位是 '/'
        else
            ret.push_back(cmd[i-1]); 
	}
    ret.push_back(cmd[n-1]);
	return ret;
}

int main()
{
	int n;
	while (cin >> n){
		vector<string> cmd(n);
		for(int i = 0; i < n; ++i)
            cin >> cmd[i];
        // 按命令长短排序
        sort(cmd.begin(), cmd.end());
		cmd = mkdir(cmd);
		for (auto& s : cmd)
			cout << "mkdir -p " << s << endl;
        cout << endl;
	}

	return 0;
}